﻿cmake_minimum_required(VERSION 3.2)

set(ENABLE_DATA_RECORDER ON) #需要记录数据为ON 否则为OFF 实车和仿真环境记录数据均适用
set(ENABLE_LABEL ON) #需要打标签为ON 否则为OFF 实车和仿真环境记录数据均适用

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
    set(SIL_SIM ON) #仿真时为ON 否则为OFF 仿真现在仅支持 windows
else()
    set(SIL_SIM OFF) 
endif()

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

set(ALGORITHM_SRC 
    ${CMAKE_CURRENT_SOURCE_DIR}/Demo/AlgorithmIF.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Demo/CalcDistance.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Demo/SystemTime.cpp) #添加算法源码

if(ENABLE_DATA_RECORDER)
    file(GLOB RECORDER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Sil/*.cpp) #添加记录数据接口代码
endif()

if(ENABLE_LABEL)
    file(GLOB_RECURSE LABEL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Sil/SilLabel/*.cpp) #添加记录标签接口代码
endif()

if(SIL_SIM)
    add_definitions(-DSIM_TIMESTAMP_INJECT) #数据时间戳注入时算法中需要的系统时间戳
else()
    if(ENABLE_LABEL)
        add_definitions(-DENABLE_LABEL_DELETE) #实车环境算法内部清楚标签的历史值
    endif()
endif()


add_library(Algorithm SHARED ${ALGORITHM_SRC} ${RECORDER_SRC} ${LABEL_SRC})
